#include <cstdio>
#include <cstring>
#include <stack>
using namespace std;

char exp[105];
stack<char> operationStack;
stack<int> dataStack;


int get_stack_priority(char c) {
	switch (c) {
		case '+':
		case '-':
			return 3;
			break;
		case '*':
		case '/':
			return 5;
			break;
		case '(':
			return 1;
			break;
		case ')':
			return 6;
			break;
	}
}

int get_current_priority(char c) {
	switch (c) {
		case '+':
		case '-':
			return 2;
			break;
		case '*':
		case '/':
			return 4;
			break;
		case '(':
			return 6;
			break;
		case ')':
			return 1;
			break;
	}
}

int calc_ab(int a, int b, char op) {
	switch (op) {
		case '+':
			return a+b;
			break;
		case '-':
			return b-a;
			break;
		case '*':
			return a*b;
			break;
		case '/':
			return b/a;
			break;
	}
}

int solve() {
	int len = strlen(exp);
	for (int i=0; i<len; i++) {
		if (exp[i] >= 40 && exp[i] <= 47) {
			if (!operationStack.empty()) {
				char prev_op = operationStack.top();
				if (get_current_priority(exp[i]) > get_stack_priority(prev_op)) {
					operationStack.push(exp[i]);
				} else if (get_current_priority(exp[i]) < get_stack_priority(prev_op)) {
					int a = dataStack.top(); dataStack.pop();
					int b = dataStack.top(); dataStack.pop();
					dataStack.push(calc_ab(a, b, prev_op));
					operationStack.pop();
					i--;
				} else {
					if (prev_op == '(') {
						operationStack.pop();
					}
				}
			} else {
				operationStack.push(exp[i]);
			}
		} else {
			int data = 0;
			while (exp[i] >= '0' && exp[i] <= '9') {
				data = data*10 + exp[i]-'0';
				i++;
			}
			i--;
			dataStack.push(data);
		}
	}
	while (!operationStack.empty()) {
		int a = dataStack.top(); dataStack.pop();
		int b = dataStack.top(); dataStack.pop();
		char prev_op = operationStack.top(); operationStack.pop();
		dataStack.push(calc_ab(a, b, prev_op));
	}
	return dataStack.top();
}

int main() {
	gets(exp);
	int result = solve();
	printf("%d\n", result);
	return 0;
}
